//
//  GifRefreshHeader.swift
//  JJToolSwift
//
//  Created by heihei on 2024/6/5.
//

import UIKit
import MJRefresh

class GifRefreshHeader: MJRefreshGifHeader {

    override func prepare() {
        super.prepare()
        self.stateLabel?.isHidden = true
        self.lastUpdatedTimeLabel?.isHidden = true
        // 设置普通状态的动画图片
        var idleArr: [UIImage] = []
        for item in 1 ... 60 {
            if let itemImg = UIImage(named: "dropdown_anim__000\(item)") {
                idleArr.append(itemImg)
            }
        }
        setImages(idleArr, for: .idle)
        
        // 设置即将刷新状态的动画图片（一松开就会刷新的状态）
        var refreshingImages: [UIImage] = []
        for item in 1 ... 3 {
            if let itemImg = UIImage(named: "dropdown_loading_0\(item)") {
                refreshingImages.append(itemImg)
            }
        }
        setImages(refreshingImages, for: .pulling)
        
        // 设置正在刷新状态的动画图片
        setImages(refreshingImages, for: .refreshing)
    }

}
